In [1]:
import matplotlib as plt
%matplotlib inline
In [2]:
import sys
sys.path.append('..')
import numpy as np
import deep_control as dc
dc.data.get_trajectory can be used to get an optimal trajectory for some initial conditions
In [3]:
conditions = {'x0': 200, 'z0': 1000, 'vx0':-30, 'vz0': 0, 'theta0': 0, 'm0': 10000}
col_names = ['t', 'm', 'x', 'vx', 'z' , 'vz',' theta', 'u1', 'u2']
In [4]:
traj = dc.data.get_trajectory('../SpaceAMPL/lander/hs/main_rw_mass.mod', conditions, col_names=col_names)
The trajectory can be visualized (xy) with dc.vis.vis_trajectory
In [5]:
dc.vis.vis_trajectory(traj)
Or all the variables and control with dc.vis.vis_control
In [6]:
dc.vis.vis_control(traj,2)
Several random trajectories can be generated (in parallell) using a direct method with dc.data.generate_data
In [7]:
params = {'x0': (-1000,1000), 'z0': (500,2000), 'vx0': (-100,100), 'vz0': (-30,10), 'theta0': (-np.pi/20,np.pi/20), 'm0': (8000,12000)}
dc.data.generate_data('../SpaceAMPL/lander/hs/main_thrusters.mod', params, 100,10)
All trajectories can then be loaded with dc.data.load_trajectories
In [8]:
col_names = ['t', 'm', 'x', 'vx', 'z', 'vz', 'theta', 'vtheta', 'u1', 'uR', 'uL']
trajs = dc.data.load_trajectories('data/main_thrusters/', col_names = col_names)
trajs[0].head(5)
Out[8]: